package com.lianxian.xindong.login.mvp.presenter;

import android.app.Application;
import android.content.Intent;

import com.hxb.library.integration.AppManager;
import com.hxb.library.di.scope.ActivityScope;
import com.hxb.library.mvp.BasePresenter;
import com.hxb.library.http.imageloader.ImageLoader;

import me.jessyan.rxerrorhandler.core.RxErrorHandler;

import javax.inject.Inject;

import com.lianxian.xindong.login.mvp.contract.RegisterContract;
import com.lianxian.xindong.login.mvp.ui.activity.LoginOtherActivity;
import com.lianxian.xindong.login.mvp.ui.activity.LoginPhoneActivity;
import com.lianxian.xindong.login.mvp.ui.activity.OtherStepOneActivity;


/**
 * @作者：hexingbo
 * @时间：07/03/2023
 * @描述：
 */
@ActivityScope
public class RegisterPresenter extends BasePresenter<RegisterContract.Model, RegisterContract.View> {
    @Inject
    RxErrorHandler mErrorHandler;
    @Inject
    Application mApplication;
    @Inject
    ImageLoader mImageLoader;
    @Inject
    AppManager mAppManager;

    @Inject
    public RegisterPresenter(RegisterContract.Model model, RegisterContract.View rootView) {
        super(model, rootView);
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        this.mErrorHandler = null;
        this.mAppManager = null;
        this.mImageLoader = null;
        this.mApplication = null;
    }

    private boolean agree;

    /**
     * 是否同意协议
     *
     * @param agree
     */
    public void checkAgreement(boolean agree) {
        this.agree = agree;
    }


    public void goLoginTypeOther() {
        mRootView.launchActivity(new Intent(mRootView.getContext(), LoginOtherActivity.class));
        mRootView.killMyself();
    }

    public void goLoginTypePhone() {
        mRootView.launchActivity(new Intent(mRootView.getContext(), LoginPhoneActivity.class));
        mRootView.killMyself();
    }

    /**
     * 提交注册参数
     *
     * @param accountNumber
     * @param accountPassword
     * @param accountPasswordTo
     * @param inviteCode
     */
    public void submitRegisterData(String accountNumber, String accountPassword, String accountPasswordTo, String inviteCode) {
        mRootView.launchActivity(new Intent(mRootView.getContext(), OtherStepOneActivity.class));
        mRootView.killMyself();
    }
}
